#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int in;
    vector<int> tmp_int;

    cout << "please input the data you want to transfer." << endl;
    cin >> in;
    cin.get();

    if (in == 0) {
        //tmp_int.push_back(0);
        cout << 0 << endl;
        return 0;
    }

    while (in)
    {
        if (in % 8)
            tmp_int.push_back(in % 8);
        else
            tmp_int.push_back(0);
        in /= 8;
    }
    //if (in == 1)
    //    tmp_int.push_back(1);
    
    for (auto i = tmp_int.rbegin(); i != tmp_int.rend();i++)
        cout << *i << " ";
    cout << endl;

    return 0;
}
